<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			var arr=[1,5,665,984,654,321,54,8,65,98,9,32,31,2,884];
			var m=0;
			for(var j=1;j<arr.length;j++){
				for(var i=0;i<arr.length-j;i++){
					if(arr[i]>arr[i+1]){
						m=arr[i];
						arr[i]=arr[i+1];
						arr[i+1]=m;
					}
				}
			}
			console.log(arr);
		</script>
	</body>
</html>
